package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.cartoonavatarmaker.lib.core.AvatarTemplateCategory;

import flc.ast.R;
import flc.ast.bean.AvatarTabBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class AvatarTabAdapter extends StkProviderMultiAdapter<AvatarTabBean> {

    public AvatarTabAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new AvatarTabProvider());
    }

    private class AvatarTabProvider extends BaseItemProvider<AvatarTabBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_avatar_tab;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, AvatarTabBean bean) {
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivAvatarTabItemImg, bean.getSelImg());
            } else {
                baseViewHolder.setImageResource(R.id.ivAvatarTabItemImg, bean.getImg());
            }
        }
    }

}
